package ink.lovejinhu.swardToOffer;

/**
 * @Author: jin
 * @ClassName: Person
 * @Date: 2021/8/20 0:28
 * @Version: V1.0
 **/
public class Offer_013 {
    public int movingCount(int m, int n, int k) {
        int res = 0;
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                int target = this.getNumSum(i) + this.getNumSum(j);
                if (target <= k) {
                    res++;
                }
            }
        }
        return res;
    }

    public int getNumSum(int n) {
        int ge = n % 10;
        int shi = n / 10 % 10;
        int bai = n / 100 % 10;
        return ge + shi + bai;
    }
}
